import Vue from 'vue'
import Router from 'vue-router'
// import Home from '@/components/Home' // 引入组件

/*后台*/
const  Admin = () => import ('@/components/admin/Admin') // 后台管理模板
const  Index = () => import ('@/components/admin/Index')  // 数据统计
const  Page  = () => import ('@/components/admin/Page' ) // 页面管理
const  Publish  = () => import ('@/components/admin/Publish')  // 发布文章
const  Article  = () => import ('@/components/admin/Article')  // 文章管理
const  Label  = () => import ('@/components/admin/Label')  // 标签
const  File = () => import ('@/components/admin/File')  // 文件管理
const  Linkz = () => import ('@/components/admin/Linkz')  // 友链
const Settings = () => import ('@/components/admin/Settings')  // 系统设置
const Jiakao = () => import('@/components/admin/jiakao') // 驾考宝典
/*前台*/
const  Login  = () => import ('../components/admin/Login.vue') 

Vue.use(Router)

export default new Router({
    routes: [
        // 后台登录
        { path: '/login', name: 'login', component: Login },

        { // 后台页面管理
            path: '/admin',
            name: 'admin',
            component: Admin,
            redirect: '/admin/index',
            children: [
                { path: '/admin/index', name: 'index', component: Index },
                { path: '/admin/page', name: 'page', component: Page },
                { path: '/admin/publish', name: 'publish', component: Publish },
                { path: '/admin/article', name: 'article', component: Article },
                { path: '/admin/file', name: 'file', component: File },
                { path: '/admin/label', name: 'label', component: Label },
                { path: '/admin/linkz', name: 'linkz', component: Linkz },
                { path: '/admin/settings', name: 'settings', component: Settings },
                { path: '/admin/jiakao', name: 'jiakao', component: Jiakao },
            ]
        },
        {
            path :'/',
            redirect :'/login'
        }

    ]
})